package com.java.mybatis.service.impl;

import com.java.mybatis.dao.EmployeesDao;
import com.java.mybatis.entity.Employees;
import com.java.mybatis.service.EmployeesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Employees)表服务实现类
 *
 * @author makejava
 * @since 2021-01-15 17:10:28
 */
@Service("employeesService")
public class EmployeesServiceImpl implements EmployeesService {


    @Resource
    private EmployeesDao employeesDao;


    /**
     * 牟恩跃----模糊查询
     * @param employeesName
     * @return
     * @throws Exception
     */
    @Override
    public List<Employees> employeeslike(String employeesName) throws Exception {
        return this.employeesDao.employeeslike(employeesName);
    }

    /**
     * 牟恩跃--条件查询
     * @param employees
     * @return
     */
    @Override
    public List<Employees> employeesList(Employees employees) {
        return this.employeesDao.employeesList(employees);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param employeesId 主键
     * @return 实例对象
     */
    @Override
    public Employees queryById(Integer employeesId) {
        return this.employeesDao.queryById(employeesId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Employees> queryAllByLimit(int offset, int limit) {
        return this.employeesDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param employees 实例对象
     * @return 实例对象
     */
    @Override
    public Employees insert(Employees employees) {
        this.employeesDao.insert(employees);
        return employees;
    }

    /**
     * 修改数据
     *
     * @param employees 实例对象
     * @return 实例对象
     */
    @Override
    public int update(Employees employees) {
        return employeesDao.update(employees);
    }

    /**
     * 通过主键删除数据
     *
     * @param employeesId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer employeesId) {
        return this.employeesDao.deleteById(employeesId) > 0;
    }

    /**
     * 通过实体作为筛选条件查询
     *
     * @param employees 实例对象
     * @return 对象列表
     */
    @Override
    public List<Employees> queryAll(Employees employees) {
        return this.employeesDao.queryAll(employees);
    }

    /**
     * 登录方法
     * @param empUserName  登录名
     * @param empUserPwd   密码
     * @return
     */
    @Override
    public Employees login(String empUserName,String empUserPwd){
        return  this.employeesDao.login(empUserName,empUserPwd);
    }
    /**
     * 查询所有员工的方法
     * @return 对象序列
     */
    @Override
    public List<Employees> queryAllEmp() {
        return this.employeesDao.queryAllEmp();
    }
    /**
     * TJS 分页查询所有员工的方法
     * @return 对象序列
     */
    @Override
    public List<Employees> getAllEmp(Integer page, Integer size) throws Exception {
        return this.employeesDao.getAllEmp(page,size);
    }
    /**
     * 查询总行数的方法
     * @return 受影响行数
     */
    @Override
    public Integer getEmpCount() throws Exception {
        return this.employeesDao.getEmpCount();
    }
    /**
     * 启用的方法
     * */
    @Override
    public void upEmployeesCodeUp(Integer id) throws Exception {
        this.employeesDao.upEmployeesCodeUp(id);
    }
    /**
     * 禁用的方法
     * */
    @Override
    public void upEmployeesCodeDown(Integer id) throws Exception {
        this.employeesDao.upEmployeesCodeDown(id);
    }

    @Override
    public List<Employees> queryLikeName(String employeesName) {
        return employeesDao.queryLikeName(employeesName);
    }

    @Override
    public List<Employees> SelEmpAll(Integer page, Integer size) throws Exception {
        return this.employeesDao.SelEmpAll(page,size);
    }

    @Override
    public Integer SelEmpNameLikeCount(String name) throws Exception {
        return this.employeesDao.SelEmpNameLikeCount(name);
    }

    @Override
    public List<Employees> SelEmpNameLike(String name, Integer page, Integer size) throws Exception {
        return this.employeesDao.SelEmpNameLike(name, page, size);
    }

    @Override
    public Integer SelEmpCount() throws Exception {
        return this.employeesDao.SelEmpCount();
    }
}